<?php
/**
 * PHP Class
 *
 * LICENSE
 *
 * Processing: Component Helper
 *
 * @category   	Gnn Cms
 * @package    	Gnn Component
 * @copyright  	Copyright vinanewstar.vn@gmail.com
 * @author		GiangNam (vinanewstar.vn@gmail.com)
 * @license    	GNU General Public License Version 2 or later (the "GPL")
 * @version     v1.0 Jun 10, 2013 || 10:42:58 AM
 */
class Zendvn_Component_Helper{
	
	public $gcComponent;
	public $gcControllerName;
	public $gcactivityName;
	
	public function __construct(Zendvn_Component_Component $component, $gcRequestParams,Zendvn_Page $page){
		$this->gcComponent 		= $component;
		// tim controller va action de chay
		$config  		   		= (array)$this->gcComponent->gcConfig;
		$control = $config['ControllerList'][$page->component_control];
		$action  = $config[$control][$page->component_action];
		if($control != "" ) $this->gcControllerName = $control;  else $this->gcControllerName  = $config['defaultController'];
		if($action != "" )  $this->gcactivityName = $action;  else $this->gcactivityName       = 'index';
	}
	
	/**
	 * get fully controller class name
	 * @return string
	 */
	public function getControllerClassName(){
		return $this->gcComponent->name.$this->gcControllerName;
	}
	
	/**
	 * get fully activity method name
	 * @return string
	 */
	public function getActivityMethodName(){
		return $this->gcactivityName.'Activity';
	}
	
	/**
	 * get component path
	 * @return string
	 */
	public function getComponentPath(){
		return $this->gcComponent->gcComponentPath;
	}
}